import { Module } from '@nestjs/common';
import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
import {
  UserModule
} from '../user/user.module'
import { JwtModule } from '@nestjs/jwt';
import { JWT_SECTET_KEY } from './auth.jwt.secrect';
import { APP_GUARD } from '@nestjs/core'
import { AuthGuard } from './auth.guard'

@Module({
  imports: [UserModule, JwtModule.register({
    global: true,
    secret: JWT_SECTET_KEY,
    // signOptions: { // 过期时间
    //   expiresIn: 24 * 60 * 60 + 's' // 24小时
    // }
  })],
  controllers: [AuthController],
  providers: [AuthService, {
    provide: APP_GUARD,
    useClass: AuthGuard
  }],
})
export class AuthModule { }
